<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../jquery/jquery-1.9.1.min.js"></script>
<script src="../jquery/js/jquery-ui-1.10.3.custom.js"></script>
<link href="../jquery/css/cupertino/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<link rel="stylesheet" href="../jquery/themes/base/jquery.ui.all.css">
<script src="../jquery/ui/jquery.ui.core.js"></script>
<script src="../jquery/ui/jquery.ui.widget.js"></script>
<script src="../jquery/ui/jquery.ui.position.js"></script>
<script src="../jquery/ui/jquery.ui.menu.js"></script>
<script src="../jquery/ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="css/demos.css">
<script type="text/javascript">
$(document).ready(function(){
	$("#s1").change(function(){
		var str="";
		//select :selected 注意中间有空格，少了空格就没有效果了
		$("select :selected").each(function(){
			str += $(this).text() + ',';
		});
		$("#div1").html('<b>' + str + '</b>');
	});
});
</script>
<style type="text/css">
body {
	font:62.5% "Trebuchet MS", sans-serif;
	margin:64px;
}
#h2-caption {
	font:20px "Trebuchet MS", sans-serif;
}
p {
	font:16px "Trebuchet MS", sans-serif;
}
select {
	font:16px "Trebuchet MS", sans-serif;
}
.demoHeaders {
	margin-top:2em;
}
#div1 {
	font:13.5px "Trebuchet MS", sans-serif;
}
#div-log {
	font:13.5px "Trebuchet MS", sans-serif;
}
</style>
<title>超实用的jQuery代码段</title>
</head>
<body>
	<h2 id="h2-caption">超实用的jQuery代码段 - jQuery取得列表控件选中的option对象</h2>
	<hr><br>
	<form>
	<select id="s1" multiple="multiple">
		<option>苏州</option>
		<option selected="selected">上海</option>
		<option>南京</option>
		<option>丹阳</option>
		<option>常州</option>
		<option>杭州</option>
		<option>无锡</option>
	</select>
	<div id="div1">option信息</div>
	</form>
	<br><hr>
	<div id="div-log">
	</div>
</body>
</html>